package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PaymentController {

    @Autowired
    PaymentService paymentService;
    @GetMapping("/provider/payment/ok/{id}")
    public String get_OK(@PathVariable("id") Long id){
        String ok = paymentService.get_OK(id);
        return ok+"，当前线程：" +Thread.currentThread().getName();
    }
    @GetMapping("/provider/payment/timeout/{id}")
    public String get_TimeOut(@PathVariable("id") Long id) throws InterruptedException {
        String timeOut = paymentService.get_TimeOut(id);
        return timeOut+",当前线程："+Thread.currentThread().getName();
    }
}
